import request from '../../../utils/request';
import type { AxiosPromise } from 'axios';
// 直接在文件中定义类型，避免导入问题
export interface CategoryProjectVO {}
export interface CategoryProjectForm {}
export interface CategoryProjectQuery {}

/**
 * 查询分类项目关联列表
 * @param query 查询参数
 * @returns 关联列表
 */
export const listCategoryProject = (query?: CategoryProjectQuery): AxiosPromise<CategoryProjectVO[]> => {
  return request({
    url: '/nav/categoryProject/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询分类项目关联详细
 * @param id 主键ID
 * @returns 关联详情
 */
export const getCategoryProject = (id: string | number): AxiosPromise<CategoryProjectVO> => {
  return request({
    url: '/nav/categoryProject/' + id,
    method: 'get'
  });
};

/**
 * 新增分类项目关联
 * @param data 关联数据
 * @returns 操作结果
 */
export const addCategoryProject = (data: CategoryProjectForm) => {
  return request({
    url: '/nav/categoryProject',
    method: 'post',
    data: data
  });
};

/**
 * 修改分类项目关联
 * @param data 关联数据
 * @returns 操作结果
 */
export const updateCategoryProject = (data: CategoryProjectForm) => {
  return request({
    url: '/nav/categoryProject',
    method: 'put',
    data: data
  });
};

/**
 * 删除分类项目关联
 * @param id 主键ID
 * @returns 操作结果
 */
export const delCategoryProject = (id: string | number | Array<string | number>) => {
  return request({
    url: '/nav/categoryProject/' + id,
    method: 'delete'
  });
};